﻿#region Using region
using System;
using System.Collections.Generic;
using System.Collections;
using System.Threading;
using System.Collections.Specialized;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;


using JigLibX.Physics;
using JigLibX.Collision;
using JigLibX.Geometry;
using JigLibX.Math;
using JigLibX.Utils;
using sqengine.PhysicObjects;
using JigLibX.Vehicles;
using System.Diagnostics;



using sqengine.Engine;
using sqengine.Components;
using sqengine.Engine.Common;


using SqEngine.Components;
using SqEngine.Audio;
using SqEngine;


using PK3Model;
#endregion

namespace sqengine
{

    partial class sqengine : Microsoft.Xna.Framework.Game
    {

        private int antialiasingQuality = 0;


        void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            PresentationParameters pp = e.GraphicsDeviceInformation.PresentationParameters;

            GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter;
            SurfaceFormat format = adapter.CurrentDisplayMode.Format;


            //SetAntiAliasing(sqconfig.AntialiasingType, adapter, format, pp);
        }


        public void SetAntiAliasing(MultiSampleType mst, GraphicsAdapter adapter, SurfaceFormat format, PresentationParameters pp)
        {
            try
            {
                if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, mst, out antialiasingQuality))
                {
                    pp.MultiSampleQuality = 2;
                    pp.MultiSampleType = MultiSampleType.FourSamples;


                    //GraphicsDevice.RenderState.MultiSampleAntiAlias = true;


                }
            }
            catch
            {
                if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, mst, out antialiasingQuality))
                {
                    pp.MultiSampleQuality = 0;
                    pp.MultiSampleType = MultiSampleType.None;


                    //GraphicsDevice.RenderState.MultiSampleAntiAlias = true;


                }

            }
        }



    }
}
